Skip to content

Configurable canonical priority range (--priority-range) - #22

Merged
stackedsax merged 1 commit into
mainfrom
feat/configurable-priority-range
Jul 18, 2026
Merged

Configurable canonical priority range (--priority-range)#22
stackedsax merged 1 commit into
mainfrom
feat/configurable-priority-range

Conversation

@stackedsax

Copy link
Copy Markdown
Contributor

What

Make the canonical priority band a parameter instead of a hardcoded 0–1000.

Every scheduler's native priority is normalized onto a common interchange band
and denormalized back on emit. That band was fixed at 0–1000, which caps
round-trip precision: PBS's 2048-value native range can't survive a pass through
a 1001-value band.

  • splat.CanonicalScale (default {0, 1000}) is the band Normalize/
    Denormalize now map through.
  • bammm convert --priority-range MIN:MAX sets it per run (default 0:1000).
    splat.ParseRange validates the value (MIN:MAX, MAX > MIN).

Goal: round-trip precision. Widening the band recovers fidelity for
schedulers with large native ranges; the default behavior is unchanged.

Demo

# source: #PBS -p 500
pbs -> pbs, default 0:1000   -> #PBS -p 501   (lossy)
pbs -> pbs, --priority-range 0:100000 -> #PBS -p 500   (exact)

(A Slurm source shows no change from widening — Slurm's native 0–1000 range is
already coarser than the band, so there's no lost precision to recover. The
benefit applies when the source range is finer than the band.)

Testing

  • TestParseRange: valid/invalid flag values.
  • TestPriority_WideCanonicalImprovesRoundTrip: the default band loses
    precision across PBS's full range; a band ≥ the native range is lossless.
  • TestConvert_PriorityRangeFlag: the flag is validated and applied
    end-to-end; omitting it restores 0–1000.
  • Full suite, go vet, gofmt clean. SPEC.md updated.

🤖 Generated with Claude Code

The interchange priority band was hardcoded to 0-1000, which caps how finely
a native priority can round-trip: PBS's 2048-value range, for instance, cannot
survive a pass through a 1001-value canonical band (e.g. -p 500 -> 501).

Introduce splat.CanonicalScale (default 0-1000) that Normalize/Denormalize map
through, and a `bammm convert --priority-range MIN:MAX` flag to set it. Widening
the band (e.g. 0:100000) makes such round-trips lossless; the default is
unchanged. splat.ParseRange validates the flag (MIN:MAX, MAX > MIN).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016PnTz6Zxqa4jHocK8kCbyx
@stackedsax
stackedsax merged commit 896f282 into main Jul 18, 2026
7 checks passed
@stackedsax
stackedsax deleted the feat/configurable-priority-range branch July 18, 2026 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant